package hypeerweb;

import java.io.ObjectStreamException;

/**
 * An extension of Node that represents a Null Node. Allows operations
 * to be performed safely on variables that would otherwise be set to null
 * or would be uninitialized.
 * 
 * @author Lance
 */
public class NullNode extends Node {

    public NullNode() {
		super(-1, -1);
		setFold(this);
		setSurFold(this);
		setInvFold(this);
    }
	
    /**
	 * Because this is the NullNode, this method does nothing
	 * @pre None
	 * @post Nothing has changed
	 * @param downPointer 
	 */
	@Override
    public void addDownPointer(Node downPointer) {
    }
    
	/**
	 * Because this is the NullNode, this method does nothing
	 * @pre None
	 * @post Nothing has changed
	 * @param neighbor 
	 */
	@Override
    public void addNeighbor(Node neighbor) {
    }

	/**
	 * Because this is the NullNode, this method does nothing
	 * @pre None
	 * @post Nothing has changed

	 * @param upPointer 
	 */
	@Override
	public void addUpPointer(Node upPointer) {
    }

	/**
	 * Because this is the NullNode, this method does nothing
	 * @pre None
	 * @post Nothing has changed

	 * @param downPointer 
	 */
	@Override
    public void removeDownPointer(Node downPointer) {
    }

	/**
	 * Because this is the NullNode, this method does nothing
	 * @pre None
	 * @post Nothing has changed

	 * @param neighbor 
	 */
	@Override
    public void removeNeighbor(Node neighbor) {
    }

	/**
	 * Because this is the NullNode, this method does nothing
	 * @pre None
	 * @post Nothing has changed

	 * @param upPointer 
	 */
	@Override
    public void removeUpPointer(Node upPointer) {
    }

	/**
	 * Because this is the NullNode, this method does nothing
	 * @pre None
	 * @post Nothing has changed

	 * @param newFold 
	 */
	@Override
    public void changeFold(Node newFold) {
    }
    
    /**
	 * Because this is the NullNode, this method does nothing
	 * @pre None
	 * @post Nothing has changed

	 * @param newFold 
	 */
	@Override
    public void setFold(Node newFold) {
    }

	/**
	 * Because this is the NullNode, this method does nothing
	 * @pre None
	 * @post Nothing has changed
	 * @param newInverseSurrogateFold 
	 */
	@Override
    public void setInverseSurrogateFold(Node newInverseSurrogateFold) {
    }

    /**
	 * Because this is the NullNode, this method does nothing
	 * @pre None
	 * @post Nothing has changed
	 * @param newSurrogateFold 
	 */
	@Override
    public void setSurrogateFold(Node newSurrogateFold) {
    }

	/**
 	 * Because this is the NullNode, this method does nothing
	 * @pre None
	 * @post Nothing has changed

	 * @param webId 
	 */
	@Override
    public void setWebId(WebId webId) {
    }


	public Object writeReplace() throws ObjectStreamException
	{
		return this;
	}
	
	public Object readResolve() throws ObjectStreamException
	{
		return NULL_NODE;
	}
}
